package com.wad.manager.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wad.entity.product.Brand;
import com.wad.manager.mapper.BrandMapper;
import com.wad.manager.service.BrandService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wad
 * @date 2023/12/07 14:05
 * @project e-commerce
 **/
@Service
public class BrandServiceImpl implements BrandService {

    @Resource
    private BrandMapper brandMapper;


    @Override
    public PageInfo<Brand> findByPage(Integer page, Integer limit) {

        PageHelper.startPage(page,limit);
        List<Brand> brandList=brandMapper.findByPage();
        PageInfo<Brand> pageInfo=new PageInfo<>(brandList);
        return pageInfo;
    }


    @Override
    public void save(Brand brand) {
        brandMapper.save(brand);
    }


    @Override
    public void update(Brand brand) {
        brandMapper.update(brand);
    }

    @Override
    public void deleteById(Long id) {
        brandMapper.deleteById(id);
    }

    @Override
    public List<Brand> findAll() {
        return brandMapper.findAll();
    }
}
